#!/usr/bin/python
# -*- coding:utf-8 -*-
# @FileName : python_test10_7.py
# Author    : myh

# 练习 10.7：加法计算器　将为练习 10.6 编写的代码放在一个 while 循
# 环中，让用户在犯错（输入的是文本而不是数）后能够继续输入数。
print('res = num1 + num2')
while True:
    num1 = input('num1=')
    try:
        num1 = int(num1)

    except ValueError:
        print('num1 is not number')
    else:
        while True:
            try:
                num2 = input('num2=')
                num2 = int(num2)
            except ValueError:
                print('num2 is not number')
            else:
                print(f'{num1} + {num2} = {num1 + num2}')
                break
        break

